﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using nplJobsCommon.Common;
using System.Data;
using System.Data.SqlClient;

namespace nplJobsDAL.Common
{
    public class QualificationDAL:DataAccessBase
    {
        public List<Qualification> GetList(Qualification obj)
        {
            DataBaseHelper dbHelper;
            DataSet ds;

            try
            {             
                dbHelper = new DataBaseHelper("SPQUALIFICATION");
                SqlParameter prm = new SqlParameter("@ID", SqlDbType.Int);
                prm.Value = obj.ID;           

                SqlParameter[] prmCollection = { prm};

                dbHelper.Parameters = prmCollection;
                ds = dbHelper.Run(base.ConnectionString, dbHelper.Parameters);


                List<Qualification> results = new List<Qualification>();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    Qualification objData = new Qualification();

                    MapperBase.GetInstance().MapItem(objData, dr); ;
                    results.Add(objData);
                }
                return results;

            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
    }
}
